saroute.cc navicache.cc psitrex.cc delgpl.cc \
ozi.cc text.cc html.cc netstumbler.cc \
igc.cc brauniger_iq.cc shape.cc hiketech.cc glogbook.cc \
- vcf.cc overlay.cc google.cc xhtmlent.cc lowranceusr.cc an1.cc tomtom.cc \
+ vcf.cc google.cc xhtmlent.cc lowranceusr.cc an1.cc tomtom.cc \
tef_xml.cc maggeo.cc vitosmt.cc gdb.cc bcr.cc \
ignrando.cc stmwpp.cc cst.cc nmn4.cc compegps.cc \
yahoo.cc unicsv.cc wfff_xml.cc garmin_txt.cc gpssim.cc \
bcr_write_line(fout, "[CLIENT]", NULL, NULL); /* client section */
bcr_write_line(fout, "REQUEST", NULL, "TRUE");
- sout = CSTRc(route->rte_name);
+ sout = route->rte_name;
if (rtename_opt != 0) {
sout = rtename_opt;
}
} else {
write_delimiter = xcsv_file.field_delimiter;
}
-#if NEW_STRINGS
+
QString description;
QString shortname;
if (wpt->shortname.isEmpty() || global_opts.synthesize_shortnames) {
if (!wpt->description.isEmpty()) {
-#else
- char* description = NULL;
- char* shortname = NULL;
- if ((! wpt->shortname) || (global_opts.synthesize_shortnames)) {
- if (wpt->description) {
-#endif
if (global_opts.synthesize_shortnames) {
shortname = mkshort_from_wpt(xcsv_file.mkshort_handle, wpt);
} else {
} else {
shortname = csv_stringclean(wpt->shortname, xcsv_file.badchars);
}
-#if NEW_STRINGS
if (wpt->description.isEmpty()) {
if (!shortname.isEmpty()) {
-#else
- if (! wpt->description) {
- if (shortname) {
-#endif
description = csv_stringclean(shortname, xcsv_file.badchars);
} else {
/* no description -- let description default on output */
}
if (prefer_shortnames) {
-#if NEW_STRINGS
-// TODO: try to figure out that original code...
description = shortname;
}
-#else
- if (description) {
- xfree(description);
- }
- description = shortname;
- } else if (description) {
- char* odesc = description;
- description = xstrdup(odesc);
- xfree(odesc);
- }
-#endif
if ((xcsv_file.gps_datum > -1) && (xcsv_file.gps_datum != GPS_DATUM_WGS84)) {
double alt;
GPS_Math_WGS84_To_Known_Datum_M(latitude, longitude, 0.0,
}
break;
case XT_SHORTNAME:
-#if NEW_STRINGS
writebuff(buff, fmp->printfc,
shortname.isEmpty() ? fmp->val : CSTR(shortname));
-#else
- writebuff(buff, fmp->printfc,
- (shortname && *shortname) ? shortname : fmp->val);
-#endif
+
break;
case XT_ANYNAME:
-#if NEW_STRINGS
{
QString anyname = wpt->shortname;
if (anyname.isEmpty()) {
}
writebuff(buff, fmp->printfc, CSTR(anyname));
}
-#else
- {
- char* anyname = NULL;
- if (wpt->shortname) {
- anyname = xstrdup(wpt->shortname);
- } else if (wpt->description) {
- anyname = mkshort(xcsv_file.mkshort_handle, wpt->description);
- } else if (wpt->notes) {
- anyname = xstrdup(wpt->notes);
- } else {
- anyname = xstrdup(fmp->val);
- }
-
- if ((anyname) && (global_opts.synthesize_shortnames)) {
- anyname = xstrdup(shortname);
- }
- writebuff(buff, fmp->printfc, anyname);
-
- xfree(anyname);
- }
-#endif
break;
case XT_DESCRIPTION:
-#if NEW_STRINGS
- writebuff(buff, fmp->printfc,
+ writebuff(buff, fmp->printfc,
description.isEmpty() ? fmp->val : CSTR(description));
-#else
- writebuff(buff, fmp->printfc,
- (description && *description) ? description : fmp->val);
-#endif
break;
case XT_NOTES:
-#if NEW_STRINGS
writebuff(buff, fmp->printfc,
wpt->notes.isEmpty() ? fmp->val : CSTR(wpt->notes));
-#else
- writebuff(buff, fmp->printfc,
- (wpt->notes && *wpt->notes) ? wpt->notes : fmp->val);
-#endif
break;
case XT_URL: {
int off = 0;
}
gbfprintf(xcsv_file.xcsvfp, "%s", xcsv_file.record_delimiter);
-#if NEW_STRINGS
-#else
- if (description && description != shortname) {
- xfree(description);
- }
- if (shortname) {
- xfree(shortname);
- }
-#endif
/* increment the index counter */
waypt_out_count++;
}
if (0 == (wp->icon_descr.compare("Geocache Found"))) {
gc_sym = 124;
}
-#if NEW_STRINGS
if (!wp->description.isEmpty()) {
-#else
- if (wp->description) {
-#endif
gbfputs(wp->description, fd);
if (!wp->gc_data->placer.isEmpty()) {
gbfprintf(fd, " by %s", wp->gc_data->placer.toUtf8().data());
{
message_t m;
msg_waypoint_t* p;
-#if NEW_STRINGS
QString name = wp->shortname;
-#else
- const char* name = wp->shortname;
-#endif
char* notes;
unsigned name_size;
unsigned notes_size = 0;
} else {
get_gc_notes(wp, &symbol, ¬es, ¬es_size);
notes_freeable = notes;
-#if NEW_STRINGS
if (!wp->description.isEmpty()) {
-#else
- if (wp->description) {
-#endif
name = mkshort(mkshort_handle, wp->description);
}
}
if (waypoint_n == 0) {
return;
}
-#if NEW_STRINGS
if (!track->rte_desc.isEmpty()) {
-#else
- if (track->rte_desc) {
-#endif
comment_size = strlen(CSTRc(track->rte_desc)) + 1;
}
message_init_size(&m, sizeof(msg_track_header_in_t) - 1 + comment_size);
p = (msg_track_header_in_t*) m.data;
memset(p->name, 0, sizeof(p->name));
-#if NEW_STRINGS
if (!track->rte_name.isEmpty()) {
-#else
- if (track->rte_name) {
-#endif
strncpy(p->name, CSTRc(track->rte_name), sizeof(p->name) - 1);
} else {
sprintf(p->name, "%lu", (long)wp_array[0]->GetCreationTime().toTime_t());
shape_n = shape_point_counts[route_point_i];
le_write32(p->total, route_point_n);
le_write32(p->index, route_point_i);
-#if NEW_STRINGS
if (!wp->shortname.isEmpty()) {
-#else
- if (wp->shortname) {
-#endif
strncpy(p->name, CSTRc(wp->shortname), sizeof(p->name) - 1);
} else {
sprintf(p->name, "RPT%u", route_point_i);
write_route_point(const Waypoint* wp)
{
wp_array[waypoint_i++] = (Waypoint*)wp;
-#if NEW_STRINGS
if (wp->shortname.startsWith("SHP")) {
-#else
- const char* s = wp->shortname;
- if (s && s[0] == 'S' && s[1] == 'H' && s[2] == 'P' && s[3] >= '0' && s[3] <= '9') {
-#endif
shape_point_n++;
shape_point_counts[route_point_n]++;
} else {
message_init_size(&m, sizeof(msg_route_header_in_t));
p = (msg_route_header_in_t*) m.data;
memset(p->name, 0, sizeof(p->name));
-#if NEW_STRINGS
if (!route->rte_name.isEmpty()) {
-#else
- if (route->rte_name) {
-#endif
strncpy(p->name, CSTRc(route->rte_name), sizeof(p->name) - 1);
} else {
sprintf(p->name, "%lu", (long)wp_array[0]->GetCreationTime().toTime_t());
garmin_fs_t* gmsd = GMSD_FIND(wpt);
write_wcstr(DST_DYN_POI);
-#if NEW_STRINGS
- write_wcstr((!wpt->shortname.isEmpty()) ? CSTRc(wpt->shortname) : "WPT");
+ write_wcstr((!wpt->shortname.isEmpty()) ? wpt->shortname : "WPT");
write_wcstr((!wpt->notes.isEmpty()) ? wpt->notes : wpt->description);
-#else
- write_wcstr((wpt->shortname) ? CSTRc(wpt->shortname) : "WPT");
- write_wcstr((wpt->notes) ? wpt->notes : wpt->description);
-#endif
write_wcstr(NULL); /* house number */
write_wcstr(GMSD_GET(addr, NULL)); /* street */
destinator_rtept_disp(const Waypoint* wpt)
{
write_wcstr(DST_ITINERARY);
-#if NEW_STRINGS
write_wcstr((!wpt->shortname.isEmpty()) ? wpt->shortname : "RTEPT");
write_wcstr((!wpt->notes.isEmpty()) ? wpt->notes : wpt->description);
-#else
- write_wcstr((wpt->shortname) ? CSTRc(wpt->shortname) : "RTEPT");
- write_wcstr((wpt->notes) ? wpt->notes : wpt->description);
-#endif
gbfputint32(0, fout);
gbfputdbl(0, fout);
bh = htable;
i = 0;
+#if NEWQ
+ foreach(Waypoint* waypointp, waypt_list) {
+ bh->wpt = waypointp;
+#else
QUEUE_FOR_EACH(&waypt_head, elem, tmp) {
bh->wpt = (Waypoint*) elem;
+#endif
bh->index = i;
i ++;
bh ++;
/* speed isn't part of a normal waypoint
WAYPT_SET(wpt, speed, speed);
*/
-#if NEW_STRINGS
if ((wpt->shortname.isEmpty() || (wpt->shortname).indexOf('@'))) {
-#else
- if ((wpt->shortname == NULL) || (! strchr(wpt->shortname, '@'))) {
-#endif
if (units == 's') {
speed = MPS_TO_MPH(speed);
} else {
speed = MPS_TO_KPH(speed);
}
-#if NEW_STRINGS
-// double check
QString base = wpt->shortname.isEmpty() ? "WPT" : wpt->shortname;
wpt->shortname = base + QString("@.%1").arg(speed);
-#else
- xasprintf(&str, "%s@%.f", wpt->shortname ? CSTRc(wpt->shortname) : "WPT", speed);
- if (wpt->shortname) {
- xfree(wpt->shortname);
- }
- wpt->shortname = str;
-#endif
}
}
gdb_find_wayptq(const queue* Q, const Waypoint* wpt, const char exact)
{
queue* elem, *tmp;
-#if NEW_STRINGS
QString name = wpt->shortname;
-#else
- const char* name = wpt->shortname;
-#endif
QUEUE_FOR_EACH(Q, elem, tmp) {
Waypoint* tmp = (Waypoint*)elem;
-#if NEW_STRINGS
if (name.compare(tmp->shortname,Qt::CaseInsensitive) == 0) {
-#else
- if (case_ignore_strcmp(name, tmp->shortname) == 0) {
-#endif
-
if (! exact) {
return tmp;
}
}
}
res = NULL;
-#if NEW_STRINGS
turn_point = (gdb_roadbook && (wpt_class > gt_waypt_class_map_point) && !tmp->description.isEmpty());
-#else
- turn_point = (gdb_roadbook && (wpt_class > gt_waypt_class_map_point) && tmp->description);
-#endif
if (turn_point || (gdb_via == 0) || (wpt_class < gt_waypt_class_map_point)) {
res = new Waypoint(*tmp);
route_add_wpt(rte, res);
/*******************************************************************************/
/* TOOLS AND MACROS FOR THE WRITER */
/*-----------------------------------------------------------------------------*/
-#if NEW_STRINGS
void FWRITE_CSTR(QString a) {
if (a.isEmpty()) {
gbfputc(0, fout);
gbfputcstr(a.toLatin1().constData(), fout);
}
}
-#else
-#define FWRITE_CSTR(a) ((a) == NULL) ? gbfputc(0,fout) : gbfputcstr((a),fout)
-#endif
+
#define FWRITE_i16(a) gbfputint16((a),fout)
#define FWRITE_i32(a) gbfputint32((a),fout)
#define FWRITE(a, b) gbfwrite(a,(b),1,fout)
GMSD_SETSTR(country, gt_get_icao_country(str));
}
}
-#if NEW_STRINGS
if (gdb_roadbook && (wpt_class > gt_waypt_class_map_point) && !res->description.isEmpty()) {
-#else
- if (gdb_roadbook && (wpt_class > gt_waypt_class_map_point) && res->description) {
-#endif
wpt_class = gt_waypt_class_user_waypoint;
GMSD_SET(wpt_class, wpt_class);
#ifdef GMSD_EXPERIMENTAL
}
if ((wpt->latitude < -90) || (wpt->latitude > 90.0))
-#if NEW_STRINGS
fatal("Invalid latitude %f in waypoint %s.\n",
lat_orig, !wpt->shortname.isEmpty() ? CSTRc(wpt->shortname) : "<no name>");
if ((wpt->longitude < -180) || (wpt->longitude > 180.0))
fatal("Invalid longitude %f in waypoint %s.\n",
lon_orig, !wpt->shortname.isEmpty() ? CSTRc(wpt->shortname) : "<no name>");
-#else
- fatal("Invalid latitude %f in waypoint %s.\n",
- lat_orig, wpt->shortname ? CSTRc(wpt->shortname) : "<no name>");
- if ((wpt->longitude < -180) || (wpt->longitude > 180.0))
- fatal("Invalid longitude %f in waypoint %s.\n",
- lon_orig, wpt->shortname ? CSTRc(wpt->shortname) : "<no name>");
-#endif
}
/*-----------------------------------------------------------------------------*/
static void
write_waypoint(
-#if NEW_STRINGS
const Waypoint* wpt, const QString& shortname, garmin_fs_t* gmsd,
-#else
- const Waypoint* wpt, const char* shortname, garmin_fs_t* gmsd,
-#endif
const int icon, const int display)
{
char zbuf[32], ffbuf[32];
FWRITE_LATLON(wpt->latitude); /* latitude */
FWRITE_LATLON(wpt->longitude); /* longitude */
FWRITE_DBL(wpt->altitude, unknown_alt); /* altitude */
-#if NEW_STRINGS
if (!wpt->notes.isEmpty()) {
-#else
- if (wpt->notes) {
-#endif
FWRITE_CSTR(wpt->notes);
} else {
FWRITE_CSTR(wpt->description);
}
/*-----------------------------------------------------------------------------*/
-#if NEW_STRINGS
-#else
-static char
-str_not_equal(const char* s1, const char* s2)
-{
- if (s1) {
- if (!s2) {
- return 1;
- }
- if (strcmp(s1, s2) != 0) {
- return 1;
- } else {
- return 0;
- }
- } else if (s2) {
- return 1;
- } else {
- return 0;
- }
-}
-#endif
static void
write_waypoint_cb(const Waypoint* refpt)
}
if ((test != NULL) && (route_flag == 0)) {
-#if NEW_STRINGS
if (test->notes != refpt->notes) {
-#else
- if (str_not_equal(test->notes, refpt->notes)) {
-#endif
test = NULL;
}
}
if (test == NULL) {
int icon, display, wpt_class;
-#if NEW_STRINGS
- QString name;
-#else
- char* name;
-#endif
Waypoint* wpt = new Waypoint(*refpt);
gdb_check_waypt(wpt);
break;
}
- name = wpt->shortname;
+ QString name = wpt->shortname;
-#if NEW_STRINGS
if (global_opts.synthesize_shortnames || name.isEmpty()) {
name = wpt->notes;
if (name.isEmpty()) {
if (name.isEmpty()) {
name = wpt->shortname;
}
-#else
- if (global_opts.synthesize_shortnames || (*name == '\0')) {
- name = wpt->notes;
- if (!name) {
- name = wpt->description;
- }
- if (!name) {
- name = wpt->shortname;
- }
-#endif
}
name = mkshort(short_h, name);
}
/* Try and make sure we have a name */
-#if NEW_STRINGS
// this kind of thing would probably be more readable like
// name = blah.
// if name.isEmpty()
name = wpt->shortname;
} else if (!wpt->description.isEmpty()) {
name = wpt->description;
-#else
- char* name = NULL;
- if ((! wpt->shortname) || global_opts.synthesize_shortnames) {
- if (wpt->description && global_opts.synthesize_shortnames) {
- name = mkshort_from_wpt(mkshort_handle, wpt);
- } else if (wpt->shortname) {
- name = wpt->shortname;
- } else if (wpt->description) {
- name = wpt->description;
-#endif
}
} else {
name = wpt->shortname;
}
-#if NEW_STRINGS
text_len = name.length();
-#else
- text_len = strlen(name);
-#endif
if (text_len > MAXUSRSTRINGSIZE) {
text_len = MAXUSRSTRINGSIZE;
}
/**
* Comments are now used by the iFinder (Expedition C supports them)
*/
-#if NEW_STRINGS
if (wpt->description != wpt->shortname) {
-#else
- if (wpt->description && strcmp(wpt->description, wpt->shortname) != 0) {
-#endif
comment = xstrdup(wpt->description);
text_len = strlen(comment);
if (text_len > MAXUSRSTRINGSIZE) {
char visible=1;
++trail_count;
-#if NEW_STRINGS
-// This whole function needs to be replaced...
+//TODO: This whole function needs to be replaced...
if (!trk->rte_name.isEmpty()) {
name = xstrdup(trk->rte_name);
} else if (!trk->rte_desc.isEmpty()) {
name = xstrdup(trk->rte_desc);
-#else
- if (trk->rte_name) {
- name = xstrdup(trk->rte_name);
- } else if (trk->rte_desc) {
- name = xstrdup(trk->rte_desc);
-#endif
} else {
tmp_name[0]='\0';
snprintf(tmp_name, sizeof(tmp_name), "Babel %d", trail_count);
char route_reversed=0;
/* route name */
-#if NEW_STRINGS
-// This whole function needs to be replaced...
+ //TODO: This whole function needs to be replaced...
if (!rte->rte_name.isEmpty()) {
name = xstrdup(rte->rte_name);
} else if (!rte->rte_desc.isEmpty()) {
name = xstrdup(rte->rte_desc);
-#else
- if (rte->rte_name) {
- name = xstrdup(rte->rte_name);
- } else if (rte->rte_desc) {
- name = xstrdup(rte->rte_desc);
-#endif
} else {
tmp_name[0]='\0';
snprintf(tmp_name, sizeof(tmp_name), "Babel R%d", ++lowrance_route_count);
char* name, tmp_name[20];
if (++trail_count == 1) {
-#if NEW_STRINGS
if (!trk->rte_name.isEmpty()) {
name = xstrdup(trk->rte_name);
} else if (!trk->rte_desc.isEmpty()) {
name = xstrdup(trk->rte_desc);
-#else
- if (trk->rte_name) {
- name = xstrdup(trk->rte_name);
- } else if (trk->rte_desc) {
- name = xstrdup(trk->rte_desc);
-#endif
} else {
tmp_name[0]='\0';
snprintf(tmp_name, sizeof(tmp_name), "Babel %d", trail_count);
#if NEWQ
// Why, oh, why is this format running over the entire waypoint list and
// modifying it? This seems wrong.
- extern QList<Waypoint*> waypt_list;
- foreach(Waypoint* waypointp, waypt_list) {
- bh->wpt = waypointp;
+// extern QList<Waypoint*> waypt_list;
+// foreach(Waypoint* waypointp, waypt_list) {
+// bh->wpt = waypointp;
+ if (false) {
#else
queue* elem, *tmp;
extern queue waypt_head;